﻿using LxBasic;
using System;

namespace LxCore
{
    public partial class ZoneCFDFields
    {
        public DOMRadiation DomRadiation;
        public void CheckCreate_Rad()
        {
            if (Temperature == null)
            {
                DomRadiation = null;
                return;
            }
            switch (PhysicalModel.RadiationType)
            {
                case RadiationTypes.DOM:
                    LxBasic.CheckCreator.Instance(ref DomRadiation);
                    DomRadiation.PreCheckCreate(Temperature);
                    DomRadiation.CheckCreate(Zone);
                    //LxSim.Sim.Solvers.InitializeGroup.Initializations.Add(DomRadiation);
                    //LxSim.Sim.Solvers.RadiationGroup.EquationsStorage.Add(DomRadiation);
                    break;
                default:
                    DomRadiation = null;
                    break;
            }
        }
        public void SetParameter_Rad()
        {
            if (DomRadiation == null) return;
            //DomRadiation.SetZone_DomTerm(T, PhysicalModel.DomType, PhysicalModel.ReferenceValue.RadiationBackgroundTemperature);
            foreach (var b in Zone.Bounds)
            {
                var bset = ZoneCond.BoundConds[b.ID];// b.CFDSetting;
                switch (bset.BoundType)
                {
                    case BoundTypes.速度入口:
                    case BoundTypes.压力出口:
                        DomRadiation.SetBound_FixRadiation(b, bset.Temperature, bset.Emissivity, bset.Reflectivity, bset.Transmissivity, bset.IsReflectivityAutoCal);
                        break;
                    case BoundTypes.壁面:
                        DomRadiation.SetBound_FollowTemperature(b, bset.Emissivity, bset.Reflectivity, bset.Transmissivity, bset.IsReflectivityAutoCal);
                        break;
                    default:
                        throw new NotImplementedException();
                }
            }
        }
    }
}
